#!/bin/bash

nvme list | grep "/dev/nvme" | while read line; do
    device=$(echo $line | awk '{print $1}')
    echo -e "\e[1;33m[root@localhost ~]# nvme smart-log $device\e[0m"
    # 使用 smartctl 命令获取基本信息
    nvme smart-log  $device
    echo -e "\e[1;33m[root@localhost ~]# nvme error-log $device | grep -i error_count | awk '{print $3}' | awk '{sum += $1} END {print sum}'\e[0m"
    nvme error-log $device | grep -i error_count | awk '{print $3}' | awk '{sum += $1} END {print sum}'
    echo "---------------------------------------"
    echo "---------------------------------------"
done

